import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Arc
import matplotlib
matplotlib.use('Agg')  # 在导入pyplot之前设置后端
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Arc



# 创建画布
fig, ax = plt.subplots(figsize=(6, 8))
ax.set_aspect('equal')
ax.axis('off')

# 绘制头部
head = Circle((0, 0), 2, facecolor='#FFE4C4', edgecolor='black')
ax.add_patch(head)

# 绘制头发（中分造型）
hair_left = Arc((-0.8, 0.5), 3, 4, angle=0, theta1=90, theta2=180, color='black')
hair_right = Arc((0.8, 0.5), 3, 4, angle=0, theta1=0, theta2=90, color='black')
ax.add_patch(hair_left)
ax.add_patch(hair_right)

# 绘制眼睛
eye_left = Circle((-0.6, 0.3), 0.3, color='black')
eye_right = Circle((0.6, 0.3), 0.3, color='black')
ax.add_patch(eye_left)
ax.add_patch(eye_right)

# 绘制嘴巴
mouth = Arc((0, -0.5), 1.5, 1, angle=0, theta1=230, theta2=310, color='red')
ax.add_patch(mouth)

# 绘制身体
body = plt.Line2D([0, 0], [-2, -6], color='black', lw=3)
ax.add_line(body)

# 绘制手臂（篮球动作）
arm_left = plt.Line2D([0, -3], [-3, -5], color='black', lw=3)
arm_right = plt.Line2D([0, 4], [-3, -3], color='black', lw=3)
ax.add_line(arm_left)
ax.add_line(arm_right)

# 绘制篮球
basketball = Circle((4, -3), 1.2, facecolor='#FF8C00', edgecolor='brown')
ax.add_patch(basketball)
# 篮球线条
plt.plot([4, 4], [-3.5, -2.5], color='brown', lw=2)
plt.plot([3.3, 4.7], [-3, -3], color='brown', lw=2)

# 绘制腿
leg_left = plt.Line2D([0, -2], [-6, -9], color='black', lw=3)
leg_right = plt.Line2D([0, 2], [-6, -9], color='black', lw=3)
ax.add_line(leg_left)
ax.add_line(leg_right)

# 添加文字
plt.text(-7, -10, 'Chicken\nYou So\nBeautiful', fontsize=12,
         color='red', weight='bold', ha='center')

# 设置坐标范围和显示
plt.xlim(-10, 10)
plt.ylim(-10, 5)
plt.savefig('ikun.svg')  # 替换 plt.show()